#!/bin/sh
#
# bash -- Start shell in a container with root for debugging
#
# Copyright (C) 2016-2020 Wu Zhangjin <lzufalcon@163.com>
#

uname | grep -q MINGW && PWD_OPT="-W"
TOP_DIR="$(cd "$(dirname "$0")"/../../ && pwd $PWD_OPT)"
. "$TOP_DIR/tools/docker/config" $* >/dev/null

docker ps -f name=$CONTAINER_NAME | grep -qv PORTS
[ $? -ne 0 ] && echo "LOG: $LAB_NAME is not running." && exit 1

[ -z "$UNIX_USER" ] && get_var UNIX_USER $DEF_USER

do_op "$WINPTY docker exec -it -w $LAB_WORKDIR/$CURRENT -u $UNIX_USER" CONTAINER_NAME "//bin/bash"
